package org.cqust.backend.repository.mission;

import org.cqust.backend.entity.mission.Mission;
import org.cqust.backend.entity.mission.MissionStepVersion;
import org.cqust.backend.entity.mission.MissionVersion;
import org.cqust.backend.entity.mission.attempt.MissionAttempt;
import org.cqust.backend.entity.mission.attempt.MissionStepAttempt;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

public interface MissionRepository extends JpaRepository<Mission, Long> {
    List<Mission> findByPublishedTrue();

    @Query("UPDATE Mission m SET m.missionVersion.id = :missionVersionId WHERE m.id = :missionId")
    void updateByMissionIdAndSetMissionVersionId(@Param("missionId") Long missionId,@Param("missionVersionId") Long missionVersionId);

}

